<template>
	<div class="main">
		<van-tabs v-model="active" @click="onClick" line-width="190px" >
			<van-tab title="账号密码登录"></van-tab>
			<van-tab title="邮箱验证码登录"></van-tab>
		</van-tabs>
	</div>
</template>

<script>
	//导入
	import Vue from 'vue';
	import {
		Tab,
		Tabs
	} from 'vant';

	Vue.use(Tab);
	Vue.use(Tabs);

	export default {
		data() {
			return {
				active: 0,
				url:['/center/login','/center/loginEmail']
			}
		},
		methods: {
			onClick(name, title) {
				this.$router.push(this.url[name])
			},
		},
		created() {
			//解决刷新，下标位置变化
			this.active = this.url.indexOf(this.$route.path);
		}
	}
</script>

<style scoped>
	.main{
		margin-top:50px;
		background-color: #f8f8f8;
	}
</style>
